# def calculate_score(angle_error, rhythm_error, range_error, stability_error):
#     """四维评分（申报书4.1）：0.4*角度 + 0.3*节奏 + 0.2*幅度 + 0.1*稳定性"""
#     # 各项误差需归一化到0-1（0为无误差，1为最大误差）
#     angle_score = (1 - angle_error) * 0.4
#     rhythm_score = (1 - rhythm_error) * 0.3
#     range_score = (1 - range_error) * 0.2
#     stability_score = (1 - stability_error) * 0.1
#     total = angle_score + rhythm_score + range_score + stability_score
#     return round(total * 100, 1)  # 转为0-100分
#
#
# def provide_feedback(action, similarity, angles, score):
#     """分级反馈（申报书4.2）：根据相似度和角度误差生成提示"""
#     feedback = {"text": "", "level": 0, "warning_joints": []}
#     if action == "识别中...":
#         feedback["text"] = "请开始动作..."
#         return feedback
#     # 1. 判定偏差等级
#     if similarity < 0.6:
#         feedback["level"] = 3
#         feedback["text"] = "动作偏差较大，请参考标准动作调整！"
#     elif similarity < 0.75:
#         feedback["level"] = 2
#         # 定位具体错误关节（如膝盖角度不足）
#         if 'left_knee' in angles and angles['left_knee'] > 160:
#             feedback["warning_joints"].append("左膝（角度过大）")
#             feedback["text"] = f"左膝角度不足，当前{angles['left_knee']:.1f}°，建议小于120°"
#     else:
#         feedback["level"] = 1
#         feedback["text"] = f"动作标准！评分：{score}分"
#     return feedback